﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace orienta.ViewModels
{
    public class PersonaInfo
    {
        public PersonaInfo() {
            this.discapacidades = new List<PersonaDiscapacidad>();
            this.PersonaDireccion = new PersonaDireccionInfo();
        }


        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Primer Nombre")]
        public String sPrimerNombre { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Segundo Nombre")]
        public String sSegundoNombre { get; set; }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Apellido Paterno")]
        public String sApellidoPaterno { get; set; }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Apellido Materno")]
        public String sApellidoMaterno { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "País")]
        public int nIdePais { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Tipo Documento")]
        //[Remote("ValidarTipoDoc", "MaePersonas", AdditionalFields = "sNumDoc")]
        public int nIdeTipoDoc { get; set; }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Remote("ValidarNumDoc", "MaePersonas", AdditionalFields = "nIdeTipoDoc")]
        [Display(Name = "Número Documento")]
        public String sNumDoc { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Tipo Persona")]
        public int nIdeTipoPers { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Género")]
        public int nIdeGenero { get; set; }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [DataType(DataType.Date, ErrorMessage = "Please enter a valid date (ex: 2/14/2011)")]
        [RegularExpression(@"^\d{1,2}\/\d{1,2}\/\d{4}$", ErrorMessage = "{0} no tiene una fecha valida")]
        [Remote("ValidarFechaNac", "MaePersonas")]
        [Display(Name = "Fecha de Nacimiento")]
        public String dtFecNac { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Teléfono 1")]
        public String sNumTelf1 { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Teléfono 2")]
        public String sNumTelf2 { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [RegularExpression(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$", ErrorMessage = "El campo {0} no tiene un formato válido.")]
        [Display(Name = "Correo Electrónico")]
        public String sEmail { get; set; }

        //mvalle
        public decimal nIdePersona { get; set; }

        public List<PersonaDiscapacidad> discapacidades { get; set; }

        public PersonaDireccionInfo PersonaDireccion { get; set; }
        
    }

    public class PersonaDireccionInfo
    {
        public PersonaDireccionInfo()
        {
            //this.referencias = new List<SolicitudReferencia>();
        }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Tipo Vía")]
        public int nIdeTipoVia { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        //[Display(Name = "Via")]
        //public String sVia { get; set; }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Nombre Vía")]
        public String sNombreVia { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Numero Vía")]
        public String sNumeroVia { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Departamento")]
        public String sDepartamento { get; set; }

        //[Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Interior")]
        public String sInterior { get; set; }

        [Display(Name = "Manzana")]
        public String sManzana { get; set; }

        [Display(Name = "Lote")]
        public String sLote { get; set; }

        [Display(Name = "Km")]
        public String sKm { get; set; }

        [Display(Name = "Block")]
        public String sBlock { get; set; }

        [Display(Name = "Etapa")]
        public String sEtapa { get; set; }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Tipo Zona")]
        public Decimal? nIdeTipoZona { get; set; }

        [Display(Name = "Nombre Zona")]
        public String sNombreZona { get; set; }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Departamento")]
        public String sUbigeoDepartamento { get; set; }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Provincia")]
        public String sUbigeoProvincia { get; set; }

        [Required(ErrorMessage = "El campo {0} es obligatorio.")]
        [Display(Name = "Distrito")]
        public String sUbigeoDistrito { get; set; }

        [Display(Name = "Centro Poblado")]
        public String sCentroPoblado { get; set; }

        [Display(Name = "Referencia 1")]
        public String sReferencia1 { get; set; }

        [Display(Name = "Referencia 2")]
        public String sReferencia2 { get; set; }

    }
}